using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace PlainConcepts.Fx.Dnie
{
    /// <summary>
    /// Common Asserts
    /// </summary>
	internal static class Asserts
	{
        /// <summary>
        /// Is String null or empty
        /// </summary>
        /// <param name="cadena">String to validate</param>
        /// <param name="argumentName">Name of argument</param>
		public static void IsNullOrEmpty(string cadena,string argumentName)
		{
			if (String.IsNullOrEmpty(cadena))
				throw new ArgumentException(string.Format(Resources.Messages.exception_Asserts_ArgumentException, argumentName));
		}
        /// <summary>
        /// Is valid path
        /// </summary>
        /// <param name="pathFile">Path to validate</param>
		public static void IsValidPath(string pathFile)
		{
			if (!File.Exists(pathFile))
				throw new ArgumentException(string.Format(Resources.Messages.exception_Asserts_PathNotFound, pathFile));
		}
        /// <summary>
        /// Is valid extension
        /// </summary>
        /// <param name="pathFile">Path to validate extension</param>
        /// <param name="extension">Extension to compare</param>
		public static void IsValidExtension(string pathFile, string extension)
		{
			IsValidPath(pathFile);
			if ( Path.GetExtension(pathFile) != extension )
				throw new ArgumentException(string.Format(Resources.Messages.exception_Asserts_IncorrectExtension, extension));

		}
	}
}
